package com.zimi.code;

import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.zimi.util.CodeUtil;
import org.apache.commons.lang.StringUtils;

import java.util.Scanner;

public class CodeGenerator {
    private static final String url = "jdbc:mysql://192.168.66.250:3306/fruit?serverTimezone=GMT%2B8";
    private static final String username = "root";
    private static final String password = "root";
    private static final String driver = "com.mysql.cj.jdbc.Driver";

    /**
     * <p>
     * 读取控制台内容
     * </p>
     */
    public static String scanner(String tip) throws MybatisPlusException {
        Scanner scanner = new Scanner(System.in);
        System.out.println(("请输入" + tip + "："));
        if (scanner.hasNext()) {
            String ipt = scanner.next();
            if (StringUtils.isNotEmpty(ipt)) {
                return ipt;
            }
        }
        throw new MybatisPlusException("请输入正确的" + tip + "！");
    }

    public static void main(String[] args) {
        new CodeUtil("lnintr", url, username, password, driver, scanner("表名，多个英文逗号分割")).Generator();
    }

}
